<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>秒杀倒计时</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f5f5f5;
        }
        .countdown-overlay {
            padding: 20px 0;
            background-color: #ff6666;
            color: #fff;
        }
        .countdown-box {
            display: inline-block;
            margin: 0 5px;
            padding: 10px;
            border-radius: 5px;
            font-weight: bold;
            font-size: 1.2em;
            background-color: #fff;
            color: #ff6666;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
    </style>
</head>
<body>
<div class="container">
    <div class="product-container">
        <img id="productImage" src="images/ldh.jpg" alt="秒杀商品">
        <div class="countdown-overlay">
            距离本次秒杀结束还剩：
            <span class="countdown-box" id="days">00</span>天
            <span class="countdown-box" id="hours">00</span>时
            <span class="countdown-box" id="minutes">00</span>分
            <span class="countdown-box" id="seconds">60</span>秒

        </div>
    </div>
</div>

<script>
    const seckillTime = 60 * 1000;
    let remainingTime = seckillTime;

    function updateCountdown() {
        const seconds = Math.floor(remainingTime / 1000);

        document.getElementById('seconds').innerText = formatTime(seconds);
    }

    function formatTime(time) {
        return time < 10 ? `0${time}` : time;
    }

    function countdown() {
        if (remainingTime <= 0) {
            clearInterval(timer);
            document.getElementById('seconds').innerText = '00';
        } else {
            remainingTime -= 1000;
            updateCountdown();
        }
    }

    const timer = setInterval(countdown, 1000);
</script>
</body>
</html>